#ifndef _REQUEST_H_
#define _REQUEST_H_

#include "connector.h"
#include "map"
#include "string"
#include "iostream"

using namespace std;

namespace easyWebServer
{


class Request
{
public:
    Request() = delete;
    Request(int fd);
    ~Request();

    string operator [] (const string & key);

    void recv();
    bool parse(const string & context);
    void insertPair(const string & key, const string & value);
    void showAllKeyValue();

private:
    void addElem(const string & key, const string & context, int & start, const string & patten);
    string findKey(const string & context, int & start, const string & patten);

private:
    int m_fd = -1;
    Connector m_conn;
    map<string, string> m_context;

};

}
#endif